<!DOCTYPE html>
<html lang="en">
    <head>
        <title>dom api test</title>
        <meta charset="UTF-8">
        <script type="application/javascript">
            function setBodyAttr(attr, value) {
                if(document.body){
                    // eval(str)将str作为js代码执行
                    eval('document.body.'+attr+'= "'+value+'" ')
                }else{
                    notSupported();
                }
            }
        </script>
    </head>

    <body>
        <div style="margin: .5in; height: 400;"> 
            <p><b><tt>text</tt>color</b></p> 
            <form> 
              <select onChange="setBodyAttr('text',
              this.options[this.selectedIndex].value);" id='1'> 
                <option value="black">black 
                <option value="darkblue">darkblue 
              </select>
              <p><b><tt>bgColor</tt></b></p>
              <select onChange="setBodyAttr('bgColor',
              this.options[this.selectedIndex].value);"> 
                <option value="white">white 
                <option value="lightgrey">gray
              </select>
              <p><b><tt>link</tt></b></p> 
              <select onChange="setBodyAttr('link',
              this.options[this.selectedIndex].value);">
                <option value="blue">blue
                <option value="green">green
              </select>  <small>
              <a href="http://www.brownhen.com/dom_api_top.html" id="sample">
              (sample link)</a></small><br>
            </form>
            <form>
              <input type="button" value="version" onclick="ver()" />
            </form>
          </div>
    </body>
</html>